package com.jy.framework.sys.controller;

import com.jy.framework.base.BaseController;
import com.jy.framework.sys.entity.SysDictDataEntity;
import com.jy.framework.sys.service.SysDictDataService;
import com.jy.framework.utils.R;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;



/**
 * 字典数据表
 *
 * @author JuiceYan
 * @email JuiceYan@jy.com
 * @date 2019-04-29 11:02:38
 */
@Api(tags = "字典数据表")
@RestController
@RequestMapping("sys/dictdata")
public class SysDictDataController extends BaseController<SysDictDataService, SysDictDataEntity> {
    @GetMapping("/type/{dictType}")
    public R selectDictDataByType(@PathVariable("dictType") String dictType){
        List<SysDictDataEntity> dictDataEntities = service.selectDictDataByType(dictType);
        return R.ok().put("data",dictDataEntities);
    }

    @GetMapping("/label/{dictType}")
    public R selectDictLabel(@PathVariable("dictType") String dictType,String dictValue){
        String label = service.selectDictLabel(dictType, dictValue);
        return R.ok().put("label",label);
    }

}
